#include<iostream>
using namespace std;
int n;
const int N = 1e5 + 10, M = 1e6 + 10;
int cnt[M];
int a[N];
int solve(int x)
{
	int ret = 0;
	for (int i = 1; i <= x / i; i++)
	{
		if (x % i == 0)
		{
			ret += cnt[i];
			ret += cnt[x / i];
			if (i == x / i) ret -= cnt[i];
		}
	}
	return ret - 1;
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> a[i];
		cnt[a[i]]++;
	}
	for (int i = 1; i <= n; i++)
	{
		cout << solve(a[i]) << endl;
	}



	return 0;
}